<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <script src="vue.js"></script>
</head>

<body>
    <div id="app">
        <!-- <input ref="inputRef" /> -->
        <input v-foucs v-color="color" />
    </div>

    <script>
        Vue.directive('foucs',{
            inserted(el,binding) {
                console.log(el)
                console.log(binding)
                el.focus()
            }
        })
        Vue.directive('color',{
            inserted(el,binding) {
                console.log(el)
                console.log(binding)
                el.style.color = binding.value
            }
        })
        var vm = new Vue({
            el: '#app',
            data: {
                color: 'blue'
            },
            mounted() {
                // this.$refs.inputRef.focus()
            },
            methods: {}
        });
    </script>
</body>

</html>